wowwikifandomcom-20200223-history
API COMBAT LOG EVENT
COMBAT_LOG_EVENT_UNFILTERED redirects to this page, but most add-on developers will want to use it in preference to COMBAT_LOG_EVENT, because the events provided by the latter will only reflect the user's actual combat log. :Note: COMBAT_LOG_EVENT and COMBAT_LOG_EVENT_UNFILTERED have identical parameters. All information provided here applies to both events. Base Parameters The timestamp parameter has almost the same format as the return value of the time() function. You can use it as the second parameter to date(). The only difference is that time() returns an integer (the unit is seconds), while the timestamp parameter has three decimal places (milliseconds). That means (timestamp-floor(timestamp))*1000 is the number of milliseconds of the timestamp. The parameters sourceFlags2 and destFlags2 appeared in patch 4.2. More information on GUIDs (including format, how to tell a player from an NPC, pets, mob IDs, and more) can be found on the API UnitGUID page. Events How to get full event strings: Read prefix to suffix in order and use the parameter table as specified. Unused entries are nil. A Blank cell means that there are no additional arguments for this pre- or suffix. Prefixes The Parameters listed with prefixes are numbered in the order they come after the base 8 parameters. SPELL_ABSORBED* - When absorbed damage originated from a spell, will have additional 3 columns with spell info. Suffixes The Parameters listed with suffixes are numbered in the order they come after the prefix parameters. * Its possible that this value does not exists. (For instance MISS or IMMUNE) Special Events † These events are pretty much useless. They are triggered when a weapon's enchant changes, but before the API information is updated to reflect the change. It is possible for main-hand and off-hand wielded weapons to have the same itemID. So we might not even know for sure which weapon the enchant changed on. When an enchant is reapplied the original is removed first, triggering an ENCHANT_REMOVED event before a ENCHANT_APPLIED event is triggered. A much better way of tracking temporary weapon enchants is to use the UNIT_INVENTORY_CHANGED event (a true event, not part of a COMBAT_LOG_EVENT_UNFILTERED) which is triggered every time an enchant changes. What's more, the information on the temporary enchants available through the API has been updated at the point this event is triggered. Sometimes the event is triggered twice however. The UNIT_DESTROYED event will fire for deaths of totems and certain instead of UNIT_DIED Parameter Values Spell School * Spell School AddOns/Blizzard_CombatLog/Blizzard_CombatLog.lua}} Coloring: COMBATLOG_DEFAULT_COLORS.schoolColoring * Spell School AddOns/Blizzard_CombatLog/Blizzard_CombatLog.lua}} Masks & Strings: SchoolStringTable Power Type Miss type *"ABSORB" *"BLOCK" *"DEFLECT" *"DODGE" *"EVADE" *"IMMUNE" *"MISS" *"PARRY" *"REFLECT" *"RESIST" Aura Type *"BUFF" *"DEBUFF" Environmental Type *"DROWNING" *"FALLING" *"FATIGUE" *"FIRE" *"LAVA" *"SLIME" *More possible but currently unconfirmed Failed Type *"A more powerful spell is already active" *"Another action is in progress" *"Can only use outside" *"Can only use while swimming" *"Can't do that while asleep" *"Can't do that while charmed" *"Can't do that while confused" *"Can't do that while fleeing" *"Can't do that while horrified" *"Can't do that while incapacitated" *"Can't do that while moving" *"Can't do that while silenced" *"Can't do that while stunned" *"Interrupted" *"Invalid target" *"Item is not ready yet" *"Must be in Bear Form, Dire Bear Form" *"Must have a Ranged Weapon equipped" *"No path available" *"No target" *"Not enough energy" *"Not enough mana" *"Not enough rage" *"Not yet recovered" *"Nothing to dispel" *"Out of range" *"Target is friendly" *"Target is hostile" *"Target needs to be in front of you." ** Added with Patch 6.1.2. Possibly to rationalize with "be behind" from rogue's Gouge. ** Not to be confused with the red alert in UI, "Target must be facing you." *"Target not in line of sight" *"Target too close" *"You are dead" *"You are in combat" *"You are in shapeshift form" *"You are unable to move" *"You can't do that yet" *"You must be behind your target." *"Your target is dead" *More possible but currently unconfirmed Examples Introduction I wanted to post some info about what I have learned about using this event. I think the description of how the arguments work is confusing. Hopefully this provides some clarity. There are always at least 8 arguments. (arg1 through arg8) Depending on the Prefix there will be 0, 1, or 3 more arguments. These will be numbered starting with 9 and going up to 11 if necessary. Depending on the Suffix there will be 0-8 more arguments. These will be numbered starting from the last Prefix argument (i.e. 9, 10, or 12). Sample Arguments Example Example: The following 2 examples show the parameters used for a SPELL_MISS event and a SWING_DAMAGE events Simple Function Example Example the following function would display a message whenever a Mind Blast crits. Foo.xml Foo_OnLoad(); Foo_OnEvent(self, event, ...); -- The ... parameter passes all arguments that would otherwise be implicitly sent prior to 3.0. -- As of 3.0, you will need to explicitly send these arguments (as done here). Foo.lua function Foo_OnLoad() this:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED"); end function Foo_OnEvent(self, event, ...) local timestamp, type, hideCaster, sourceGUID, sourceName, sourceFlags, sourceFlags2, destGUID, destName, destFlags, destFlags2 = select(1, ...) -- Note, for this example, you could just use 'local type = select(2, ...)'. The others are included so that it's clear what's available. if (event "COMBAT_LOG_EVENT_UNFILTERED") then if (type "SPELL_DAMAGE") then local spellId, spellName, spellSchool = select(12, ...) -- Use the following line in game version 3.0 or higher, for previous versions use the line after local amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing = select(15, ...) if (spellName "Mind Blast" and critical true) then -- true for clarity only. Not needed. DEFAULT_CHAT_FRAME:AddMessage("Mind Blast Just Critted!"); end end end end Event Descriptions Summary Of what I have learned about when events fire and when they don't: (Preliminary) Prefixes Suffixes Special Events Category:API events